#include <iostream>
using namespace std;

#include "company1.h"

Company::Company()
{
	bestPaid = Employee();
}//default constructor

void Company::findBestPaid()
{
	//please implement this method using the overloaded operator > and = for the Employee class
	ListCont<Employee>::Iterator it;
	it = empContainer.Begin();
	while (true)
	{
		if (it == empContainer.End()) break;
		if ((*it) > bestPaid) bestPaid = (*it);
		it++;
	}
	
} // findBestPaid


void Company::printBestPaid() const
{
	cout << "The best-paid employee and gross pay:" << endl;
	bestPaid.output();
} // printBestPaid

void Company::findBestPaidReverse()
{
	ListCont<Employee>::Iterator it = empContainer.End();
     while (true)
     {
        if (it == empContainer.Begin()) break;
        it --;
        if ((*it) > bestPaid) bestPaid = (*it);
     }
}

void Company::inputEmployee() {
    while (1 == 1) {
        bestPaid.input();
        string n = bestPaid.getName();
        if (n == "*") break;
        else if (n != "*") empContainer.addHead(bestPaid);
    }
}

